SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[SP_TDFLUJ_PROY_SEMA_I01]  
/*-----------------------------------------------------*/          
/*---Empresa               OFISIS S.A.              --*/          
/*---Cliente               CIA Hitepima       --*/          
/*---Sistema               Tesoreria        --*/          
/*---M¢dulo                Empresa         --*/          
/*---Programa              FLUJO DE CAJA PROY. MENSUAL--*/          
/*---Script                SP_TDFLUJ_PROY_I01.sql --*/          
/*---Nombre SP             SP_TDFLUJ_PROY_I01  --*/          
/*---Desarrollado por      Carlos Marquez   --*/          
/*---Fecha Creaci¢n        02/06/2006    --*/          
/*---Base Datos            SQL SERVER    --*/          
/*---Versi¢n               2000      --*/          
/*---Graba Plantilla Flujo Ejecutado Cabecera y Detalle --*/  
/*-----------------------------------------------------*/          
/*-----------------------------------------------------*/          
/*---Modificado 1 por                   --*/          
/*---Fecha Modificaci¢n                 --*/           
/*---Detalle Modificaci¢n               --*/          
/*-------------------------------------------------------*/          
/*-------------------------------------------------------*/          
/*--- Drop Proc SP_TDFLUJ_PROY_I01          --*/          
/*--- Grant Execute on SP_TDFLUJ_PROY_I01 to public   --*/           
/*--- SP_TDFLUJ_PROY_I01 '01', 2006, 1     --*/          
/*--------------------------------------------------------*/          
@ISCO_EMPR  TD_VC_002,     
@ISCO_USUA_MODI TD_VC_008,  
@INNU_ANIO  TD_IN_001,  
@INNU_SECU  TD_IN_001,  
@IDFE_PROY  TD_DT_001,  
@ISCO_MONE  TD_VC_003,  
@INFA_TIPO_CAMB         TD_NU_015_006  
  
As          
  
 Declare     
    @VNNU_SECU TD_IN_001  
 Begin Tran SP_TDFLUJ_PROY_SEMA_I01    
    
  
 --- Insertamos Cabecera ----  
 Insert Into TCFLUJ_PROY_SEMA 
 (CO_EMPR, NU_ANIO, NU_SECU, FE_PROY, CO_MONE, FA_TIPO_CAMB,  
 CO_USUA_CREA, FE_USUA_CREA, CO_USUA_MODI, FE_USUA_MODI)  
 Values  
 (@ISCO_EMPR, @INNU_ANIO, @INNU_SECU, @IDFE_PROY, @ISCO_MONE, @INFA_TIPO_CAMB,  
 @ISCO_USUA_MODI, GetDate(), @ISCO_USUA_MODI, GetDate())  
 If @@error <> 0  
 Begin  
  Rollback tran SP_TDFLUJ_PROY_SEMA_I01
  Return  
 End  
  
 -- Insertamos Detalle          
 Insert Into TDFLUJ_PROY_SEMA  
 (CO_EMPR, NU_ANIO, NU_SECU,   
 CO_ARUB, CO_RUBR, CO_CLSU,  
 IM_SALD_INIC,  
  IM_CALC_SE01, IM_CALC_SE02, IM_CALC_SE03, IM_CALC_SE04,    
 IM_CALC_SE05, IM_CALC_SE06, IM_CALC_SE07, IM_CALC_SE08,    
 IM_CALC_SE09, IM_CALC_SE10, IM_CALC_SE11, IM_CALC_SE12,   
 IM_CALC_SE13, IM_CALC_SE14, IM_CALC_SE15, IM_CALC_SE16,    
 IM_CALC_SE17, IM_CALC_SE18, IM_CALC_SE19, IM_CALC_SE20,    
 IM_CALC_SE21, IM_CALC_SE22, IM_CALC_SE23, IM_CALC_SE24,  
 IM_CALC_SE25, IM_CALC_SE26, IM_CALC_SE27, IM_CALC_SE28,    
 IM_CALC_SE29, IM_CALC_SE30, IM_CALC_SE31, IM_CALC_SE32,    
 IM_CALC_SE33, IM_CALC_SE34, IM_CALC_SE35, IM_CALC_SE36,  
 IM_CALC_SE37, IM_CALC_SE38, IM_CALC_SE39, IM_CALC_SE40,    
 IM_CALC_SE41, IM_CALC_SE42, IM_CALC_SE43, IM_CALC_SE44,    
 IM_CALC_SE45, IM_CALC_SE46, IM_CALC_SE47, IM_CALC_SE48,  
 IM_CALC_SE49, IM_CALC_SE50, IM_CALC_SE51, IM_CALC_SE52,    
 IM_CALC_SE53, IM_CALC_SE54, IM_CALC_SE55, IM_CALC_SE56,    
 IM_CALC_SE57, IM_CALC_SE58, IM_CALC_SE59, IM_CALC_SE60, CO_MONE, FA_TIPO_CAMB,  
 CO_USUA_CREA, FE_USUA_CREA, CO_USUA_MODI, FE_USUA_MODI)  
 (  
 Select CO_EMPR, NU_ANIO, NU_SECU,   
 CO_ARUB, CO_RUBR, CO_CLSU,  
 IM_SALD_INIC,  
  IM_CALC_SE01, IM_CALC_SE02, IM_CALC_SE03, IM_CALC_SE04,    
 IM_CALC_SE05, IM_CALC_SE06, IM_CALC_SE07, IM_CALC_SE08,    
 IM_CALC_SE09, IM_CALC_SE10, IM_CALC_SE11, IM_CALC_SE12,   
 IM_CALC_SE13, IM_CALC_SE14, IM_CALC_SE15, IM_CALC_SE16,    
 IM_CALC_SE17, IM_CALC_SE18, IM_CALC_SE19, IM_CALC_SE20,    
 IM_CALC_SE21, IM_CALC_SE22, IM_CALC_SE23, IM_CALC_SE24,  
 IM_CALC_SE25, IM_CALC_SE26, IM_CALC_SE27, IM_CALC_SE28, 
IM_CALC_SE29, IM_CALC_SE30, IM_CALC_SE31, IM_CALC_SE32,    
 IM_CALC_SE33, IM_CALC_SE34, IM_CALC_SE35, IM_CALC_SE36,  
 IM_CALC_SE37, IM_CALC_SE38, IM_CALC_SE39, IM_CALC_SE40,    
 IM_CALC_SE41, IM_CALC_SE42, IM_CALC_SE43, IM_CALC_SE44,    
 IM_CALC_SE45, IM_CALC_SE46, IM_CALC_SE47, IM_CALC_SE48,  
 IM_CALC_SE49, IM_CALC_SE50, IM_CALC_SE51, IM_CALC_SE52,    
 IM_CALC_SE53, IM_CALC_SE54, IM_CALC_SE55, IM_CALC_SE56,    
 IM_CALC_SE57, IM_CALC_SE58, IM_CALC_SE59, IM_CALC_SE60, @ISCO_MONE, @INFA_TIPO_CAMB,  
 @ISCO_USUA_MODI, GetDate(), @ISCO_USUA_MODI, GetDate()  
 From #TWFLUJ_PROY_SEMA  
 Where  
 CO_EMPR =  @ISCO_EMPR And  
 NU_ANIO =  @INNU_ANIO And  
 NU_SECU =  @INNU_SECU   
 )  
 If @@error <> 0  
 Begin  
  Rollback tran SP_TDFLUJ_PROY_SEMA_I01  
  Return  
 End  
  
  
        
commit tran  SP_TDFLUJ_PROY_SEMA_I01    
/*------------------------ Fin ------------------------------*/


GO
